package exercise.jslide.jslide.model.text;


import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;

import java.io.Serializable;


public class TextStyle implements Serializable {
    private FontPosture fontPosture; // 字体样式
    private FontWeight fontWeight; // 字体粗细

    public TextStyle() {
        this.fontPosture = FontPosture.REGULAR;
        this.fontWeight = FontWeight.NORMAL;
    }



    // 获取字体样式
    public FontPosture getFontPosture() {
        return fontPosture;
    }

    // 设置字体样式
    public void setFontStyle(FontPosture fontPosture) {
        this.fontPosture = fontPosture;
    }

    // 获取字体粗细
    public FontWeight getFontWeight() {
        return fontWeight;
    }

    // 设置字体粗细
    public void setFontWeight(FontWeight fontWeight) {
        this.fontWeight = fontWeight;
    }

    public String getFontStyleString() {
        return fontPosture == FontPosture.REGULAR ? "normal" : "italic";
    }

    // 获取字体粗细的字符串表示

    public String getFontWeightString() {
        switch (fontWeight) {
            case THIN:
                return "100";
            case EXTRA_LIGHT:
                return "200";
            case LIGHT:
                return "300";
            case NORMAL:
                return "400";
            case MEDIUM:
                return "500";
            case SEMI_BOLD:
                return "600";
            case BOLD:
                return "700";
            case EXTRA_BOLD:
                return "800";
            case BLACK:
                return "900";
            default:
                return "400"; // 默认返回normal
        }
    }
}